<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2017/8/19
 * Time: 9:20
 */

namespace app\file\controller;

use think\Controller;

class File extends Controller
{
    public function index()
    {
        return $this->view->fetch("index");
    }

    public function uploadImg()
    {
        $file = $this->request->file("image");
        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'image');
        if ($info) {//成功
            return $info->getSaveName();
        } else {
            return $file->getError();
        }
    }
}